﻿using System;
using UnityEngine;

// Token: 0x020001B8 RID: 440
public class CutAct_Expression : CutAction
{
	// Token: 0x06000B6D RID: 2925 RVA: 0x00042FD8 File Offset: 0x000411D8
	public CutAct_Expression(CutScene cutScene) : base(cutScene, CUTACT.EXPRESSION)
	{
	}

	// Token: 0x06000B6E RID: 2926 RVA: 0x00043024 File Offset: 0x00041224
	public override object Clone()
	{
		return new CutAct_Expression(this.cutScene);
	}

	// Token: 0x06000B6F RID: 2927 RVA: 0x00043034 File Offset: 0x00041234
	public override void Load(TagText.Element element, int order)
	{
		base.Load(element, order);
		element.GetVal(ref this.chara, "chara", 0);
		element.GetVal(ref this.eye, "eye", 0);
		element.GetVal(ref this.eyeOpen, "eye", 1);
		element.GetVal(ref this.mouth, "mouth", 0);
		element.GetVal(ref this.mouthOpen, "mouth", 1);
		element.GetVal(ref this.duration, "duration", 0);
		element.GetVal(ref this.look, "look", 0);
		element.GetVal(ref this.flush, "flush", 0);
		element.GetVal(ref this.tear, "tear", 0);
	}

	// Token: 0x06000B70 RID: 2928 RVA: 0x000430F4 File Offset: 0x000412F4
	public override void Save(TagText.Element element)
	{
		base.Save(element);
		element.AddAttribute("chara", this.chara);
		element.AddAttribute("eye", this.eye + "," + this.eyeOpen);
		element.AddAttribute("mouth", this.mouth + "," + this.mouthOpen);
		element.AddAttribute("duration", this.duration.ToString());
		element.AddAttribute("look", this.look.ToString());
		element.AddAttribute("flush", this.flush);
		element.AddAttribute("tear", this.tear);
	}

	// Token: 0x06000B71 RID: 2929 RVA: 0x000431BC File Offset: 0x000413BC
	public override void Action(bool skip)
	{
		Human human = this.cutScene.GetHuman(this.chara);
		human.ExpressionPlay(0, this.eye, this.duration);
		human.ExpressionPlay(1, this.mouth, this.duration);
		if (human.blink != null)
		{
			human.blink.LimitMax = this.eyeOpen * 0.01f;
		}
		if (human.lipSync != null)
		{
			human.lipSync.RelaxOpen = this.mouthOpen * 0.01f;
		}
		if (this.flush.Length > 0)
		{
			human.SetFlush(float.Parse(this.flush) * 0.01f, false);
		}
		if (this.tear.Length > 0)
		{
			human.SetTear(float.Parse(this.tear) * 0.01f, false);
		}
		if (this.look.Length > 0)
		{
			if (this.look.Equals("カメラ") || this.look.Equals("Camera", StringComparison.OrdinalIgnoreCase))
			{
				human.ChangeEyeLook(LookAtRotator.TYPE.TARGET, this.cutScene.camera.transform, false);
			}
			else
			{
				Vector3 zero = Vector3.zero;
				if (this.look.IndexOf("右") != -1)
				{
					zero.y = 45f;
				}
				else if (this.look.IndexOf("左") != -1)
				{
					zero.y = -45f;
				}
				if (this.look.IndexOf("上") != -1)
				{
					zero.x = -45f;
				}
				else if (this.look.IndexOf("下") != -1)
				{
					zero.x = 45f;
				}
				if (zero.magnitude > 0f)
				{
					human.ChangeEyeLook(LookAtRotator.TYPE.DIRECTION, zero, false);
				}
				else
				{
					Human human2 = this.cutScene.GetHuman(this.look);
					if (human2 != null)
					{
						human.ChangeEyeLook(LookAtRotator.TYPE.TARGET, human2.HeadPosTrans, false);
					}
					else
					{
						human.ChangeEyeLook(LookAtRotator.TYPE.FORWARD, null, false);
					}
				}
			}
		}
	}

	// Token: 0x04000BB3 RID: 2995
	public string chara;

	// Token: 0x04000BB4 RID: 2996
	public string eye;

	// Token: 0x04000BB5 RID: 2997
	public float eyeOpen = 100f;

	// Token: 0x04000BB6 RID: 2998
	public string mouth;

	// Token: 0x04000BB7 RID: 2999
	public float mouthOpen;

	// Token: 0x04000BB8 RID: 3000
	public float duration = 0.5f;

	// Token: 0x04000BB9 RID: 3001
	public string look = string.Empty;

	// Token: 0x04000BBA RID: 3002
	public string flush = string.Empty;

	// Token: 0x04000BBB RID: 3003
	public string tear = string.Empty;
}
